local jianyuan = fk.CreateSkill {
    name = "jinhs__jianyuan",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable {
    ["jinhs__jianyuan"] = "简远",
    [":jinhs__jianyuan"] = "锁定技，当你成为其他角色使用牌的目标时，若其本回合使用过的牌数等于X，取消之（X为你的体力值+1）。",

    ["$jinhs__jianyuan1"] = "我视天地为三，其为众妙之门。",
    ["$jinhs__jianyuan2"] = "昔年孔明有言，宁静方能致远。",
}

jianyuan:addEffect(fk.TargetConfirming, {
    anim_type = "defensive",
    can_trigger = function(self, event, target, player, data)
        if target == player and player:hasSkill(jianyuan.name) and data.from and data.from ~= player then
            local x = player.hp + 1
            local num = 0
            player.room.logic:getEventsOfScope(GameEvent.UseCard, 99, function(e)
                local use = e.data
                if use.from == data.from then
                    num = num + 1
                end
            end, Player.HistoryTurn)
            if num == x then
                return true
            end
        end
    end,
    on_use = function(self, event, target, player, data)
        if player.dead then return end
        data:cancelTarget(player)
    end,
})

return jianyuan
